import SearchAdv from '../components/emap-search-adv'
import EmapTable from '../components/emap-table'
import SubForm from './sub-form'
import SubGrid from './sub-grid'
import FlowChart from './flow-chart'
import FlowStatus from './flow-status'
import EmapFlowComment from './emap-flow-comment'
import EmapFlowNextStep from './emap-flow-next-step'
import SectionTitle from './section-title'
import RawHtml from './raw-html'
import PrintForm from './print-form'
import RichText from './rich-text'

const ControlTypes = {
  'datatable': EmapTable,
  'searchadv': SearchAdv,
  [SubForm.name]: SubForm,
  [SubGrid.name]: SubGrid,
  [FlowChart.name]: FlowChart,
  [EmapFlowComment.name]: EmapFlowComment,
  [EmapFlowNextStep.name]: EmapFlowNextStep,
  [SectionTitle.name]: SectionTitle,
  [FlowStatus.name]: FlowStatus,
  [RawHtml.name]: RawHtml,
  [PrintForm.name]: PrintForm,
  [RichText.name]: RichText,
}

// 根据控件类型获取渲染组件
export const getControl = (type) => {
  return type && ControlTypes[type] || null
}
